package me.zk.practice1.hw;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zhangkai
 * @date 2023/8/7 18:24
 */
public class HWBJ66 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String s = scanner.nextLine();

        String[] snums = s.split(",");

        String s1 = snums[0].substring(1,snums[0].length()-1);

        int[] nums = Arrays.stream(s1.split(" ")).mapToInt(Integer::parseInt).toArray();

        int n = Integer.parseInt(snums[1]);

        //获取中位数
        int[] ss = Arrays.copyOf(nums,nums.length);
        Arrays.sort(ss);

        int c = ss[ss.length/2];

        int min =Integer.MAX_VALUE;
        int index = -1;
        for (int i = 0; i < nums.length - n + 1; i++) {
            int count = nums[i];
            for (int j = i+1; j < i+n; j++) {
                count-=nums[j];
            }
            if (min > Math.abs(count - c)) {
                min = Math.abs(count-c);
                index = i;
            }


        }

        System.out.println(index);
    }
}
